import pandas as pd
import os

class ReadAndWriteExcel():

    def read_excel(self,filePath):
        try:
            return pd.read_excel(filePath).values.tolist()
        except Exception as e:
            print(e)

    def write_excel(self,filePath, fileData):
        if os.path.exists(filePath):
            pd.DataFrame(fileData).to_excel(filePath, index=False)
        else:
            open(filePath, "w").close()
            pd.DataFrame(fileData).to_excel(filePath, index=False)